{extend name="layout" /}
{block name="content"}
<div class="row">
  <div class="col-xs-3">
    <form id="searchForm">
      <div class="input-group input-group-sm demoTable">
        <input type="text" class="form-control input-sm" name="keywords" id="demoReload" autocomplete="off" placeholder="请输入关键字">
        <span class="input-group-btn">
          <button type="button" class="btn btn-info btn-flat layui-btn" data-type="reload">搜  索</button>
        </span>
      </div>
    </form>
  </div>
  <div class="col-xs-9" style="text-align: right">
    <button type="button" class="btn btn-danger btn-sm cocoAjax" confirm="确定要删除吗？" checkItem="1:0" ajaxUrl="{:url('data_delete',array('model'=>$model))}"><i class="fa fa-remove"></i> 批量删除</button>
     <button type="button" class="btn btn-info btn-sm export" title="积分表"><i class="fa fa-edit"></i> 数据导出</button>
  </div>
</div>
  
<table class="layui-table" lay-data="{height: 'full-75', cellMinWidth: 80, page: true, id:'lists',limit:30, url:'{:url('data_show_where')}'}" lay-filter="lists">
  <thead>
    <tr class="layui-colla-content">
      <th lay-data="{type:'checkbox'}">ID</th>
      <th lay-data="{field:'id', sort: true}">ID</th>
      <th lay-data="{field:'nickname'}">昵称</th>
      <th lay-data="{field:'dealer'}">所属经销商</th>
      <th lay-data="{field:'nums'}">积分数量</th>
      <th lay-data="{field:'typename'}">类型</th>
      <th lay-data="{field:'goodsname'}">兑换商品名称</th>
      <th lay-data="{field:'adddate'}">添加时间</th>
      <!-- <th lay-data="{fixed: 'right', width:200, align:'center', toolbar: '#barDemo'}">操作</th> -->
  </thead>
</table>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
{/block}
{block name="script"}
<script type="text/javascript">
  layui.use('table', function(){
    var table = layui.table;
    var $ = layui.$, active = {
      reload: function(){
        var demoReload = $('#demoReload');
        //执行重载
        table.reload('lists', {
          page: {
            curr: 1 //重新从第 1 页开始
          }
          ,where: $('#searchForm').serializeObject()
        });
      }
    };
    $('.demoTable .layui-btn').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
  });
</script>
{/block}